﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Diagnostics;
using kTudu.Web.Helpers;

namespace kTudu.Web.Infraestructure
{
    [DebuggerStepThrough]
    public static class Try
    {
        public static void It(Action action)
        {
            try
            {
                action();
            }
            catch (Exception ex)
            {
                try
                {
                    Logger.Write(ex);
                }
                catch (Exception ex33)
                {

                    throw ex33;
                }

                //throw ex;
            }
        }

        public static T It<T>(Func<T> action)
        {
            try
            {
                var result = action();

                return result;
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
                throw ex;
            }
        }
    }
}